﻿using EnergyDrink_Infrastructure;
using EnergyDrink_Infrastructure.Behaviors;
using Microsoft.Practices.Unity;
using Microsoft.Practices.Prism.Modularity;
using Microsoft.Practices.Prism.UnityExtensions;
using System;
using System.ComponentModel.Composition.Hosting;
using System.Windows;

namespace EnergyDrinkMain
{

    public partial class EnergyDrinkMainBootstrapper : UnityBootstrapper
    {
        
        protected override IModuleCatalog CreateModuleCatalog()
        {
            return base.CreateModuleCatalog();
           
        }


        protected override void InitializeShell()
        {
            base.InitializeShell();

            Application.Current.MainWindow = (Window)this.Shell;  // 초기화된 쉘을 매인 윈도우에 넣는다.

            Application.Current.MainWindow.Show();  // 쉘이 들어간 메인 윈도우를 실행한다.

            IModule moduleA = Container.Resolve<Menu.Menu>();
            moduleA.Initialize();

            IModule moduleB = Container.Resolve<VIew1.View1>();
            moduleB.Initialize();

            IModule moduleC = Container.Resolve<Person.PersonModule>();
            moduleC.Initialize();

            IModule moduleD = Container.Resolve<HumanResource.HumanResource>();
            moduleD.Initialize();

            IModule moduleE = Container.Resolve<MainTitle.MainTitle>();
            moduleE.Initialize();

            //IModule moduleF = Container.Resolve<LoNumberMenu.LoNumberMenu>();
            //moduleF.Initialize();

            IModule moduleG = Container.Resolve<LoNumber.LoNumberModule>();
            moduleG.Initialize();

            IModule moduleH = Container.Resolve<Product_1.Product_1_Module>();
            moduleH.Initialize();

            IModule moduleI = Container.Resolve<HumanResource2.HumanResource2_Module>();
            moduleI.Initialize();

            IModule moduleJ = Container.Resolve<Product_2.Product_2_Module>();
            moduleJ.Initialize();

            IModule moduleK = Container.Resolve<Ending.EndingModule>();
            moduleK.Initialize();

            IModule moduleL = Container.Resolve<Output.OutputModule>();
            moduleL.Initialize();

            IModule moduleM = Container.Resolve<Product_1_1.Product_1_1_Module>();
            moduleM.Initialize();

            IModule moduleN = Container.Resolve<Product_1_2.Product_1_2_Module>();
            moduleN.Initialize();

            IModule moduleO = Container.Resolve<Product_1_3.Product_1_3_Module>();
            moduleO.Initialize();

            IModule moduleP = Container.Resolve<Product_2_1.Product_2_1_Module>();
            moduleP.Initialize();

            IModule moduleQ = Container.Resolve<Product_2_2.Product_2_2_Module>();
            moduleQ.Initialize();

            IModule moduleR = Container.Resolve<Product_2_3.Product_2_3_Module>();
            moduleR.Initialize();


        }
        protected override void ConfigureContainer()
        {
            Container.RegisterType<IShellView, Shell>();
            
            base.ConfigureContainer();
        }

        protected override DependencyObject CreateShell()
        {
            ShellPresenter presenter = Container.Resolve<ShellPresenter>();
            IShellView view = presenter.View;

            view.ShowView();

            return view as DependencyObject;
        }
    }
}
    
